<?php

namespace app\data\controller\sys;

use think\admin\Controller;

/**
 * 平台设置
 * Class Balance
 * @package app\data\controller\notarialoffice
 */
class Config extends Controller
{

    /**
     * 平台设置
     * @auth true
     * @menu true
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        $this->title = '平台设置';
        if ($this->request->isGet()) {
            $this->phone = sysconf('config.phone');
            $this->sdkappid = sysconf('vx.sdkappid');
            $this->sdkappkey = sysconf('vx.sdkappkey');
            $this->aboutus = sysconf('config.aboutus');
            $this->agreement = sysconf('config.agreement');
            $this->privacy = sysconf('config.privacy');
        }else{
            $phone = input('phone');
            sysconf('config.phone',$phone);
            $this->phone = $phone;

            $sdkappid = input('sdkappid');
            sysconf('vx.sdkappid',$sdkappid);
            $this->sdkappid = $sdkappid;

            $sdkappkey = input('sdkappkey');
            sysconf('vx.sdkappkey',$sdkappkey);
            $this->sdkappkey = $sdkappkey;

            $aboutus = input('aboutus');
            sysconf('config.aboutus',$aboutus);
            $this->aboutus = $aboutus;

            $agreement = input('agreement');
            sysconf('config.agreement',$agreement);
            $this->agreement = $agreement;

            $privacy = input('privacy');
            sysconf('config.privacy',$privacy);
            $this->privacy = $privacy;
        }
        $this->fetch();
    }

}